import pymysql

con = pymysql.connect(host='localhost', user='root', password='123456', database='1_test', port=3306,
                      charset='utf8')
try:
    with con.cursor() as cursor:
        sql1 = 'create table user(''id int(11),' 'idcard varchar(50),' 'username varchar(50),' 'realname varchar(50),' 'pwd varchar(50),' 'telphone varchar(12),' 'email varchar(100),' 'age int(11),' 'sex varchar(200),' 'address varchar(200),' 'hiredate date,' 'sal double(9,2),' 'job varchar(100),' 'company varchar(100));'
        sql2 = 'create table user1(''id int(11),' 'idcard varchar(50),' 'username varchar(50),' 'realname varchar(50),' 'pwd varchar(50),' 'telphone varchar(12),' 'email varchar(100),' 'age int(11),' 'sex varchar(200),' 'address varchar(200),' 'hiredate int,' 'sal double(9,2),' 'job varchar(100),' 'company varchar(100));'
        cursor.execute(sql2)
        cursor.execute("desc user1")
        cursor.execute(sql1)
        cursor.execute('show tables')
        cursor.execute("desc user")
finally:
    con.close()

print("数据表user创建成功！")